package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//商品下架监听器
@Component
public class GoodsDownListener {
    @Autowired
    private EsManagerService esManagerService;
    //从rabbitmq中取出数据，然后删除索引库
    @RabbitListener(queues = RabbitMQConfig.SEARCH_DEL_QUEUE)
    public void getMessage(String message){
        System.out.println("删除索引库监听类,接收到的spuId:"+message);
        //调用业务层删除索引库
        esManagerService.delDataBySpuId(message);
    }
}
